<?php
$HTMLstr .= '<div class="body">
        <div class="findOne">
        <div class="findOneInside">';
if(0 != $this->oneModel->getImg()) {
    $HTMLstr .= '<div class="findOneInsideImg">
        <img width="100%" src="stuff/images/saved/'. model_ConfigMapper::findAvatar($this->oneModel->getImg()) .'.jpg">
        </div>';
}
$HTMLstr .= '<div class="findOneInside">
    <div class="head">
    <b>' . $this->oneModel->getTitle() . '</b>
        </div>
        <div class="fetchallOneInsidePost">
        '. $this->oneModel->getContent() .'
            </div>

            <div class="findOneInsideSign">
            <div class="fetchallOneInsideAvatar">
            <a href="?controller=user&id='. $this->oneModel->getAuthor() .'">
            <img height="100%" src="stuff/images/saved/'. model_ConfigMapper::findAvatar2($this->user->getId()) .'.jpg">
            </a>
            </div>
            <div class="findOneInsideLeft">
            <div class="fetchallOneInsideTitle">
             Добавил:
             </div>
            <div class="fetchallOneInsideTitle">
            <a href="?controller=user&id='. $this->oneModel->getAuthor() .'">'
        . $this->user->getName() .'
            '. $this->user->getUsername() .'
            '. $this->user->getSurname() .'</a>
                </div>
                <div class="fetchallOneInsideTitle">
                '. $this->oneModel->getDate() .'
                </div>
                </div>';

if (null != $user->getId()) {
    if ( 'admin' == $user->getRole() ||  $user->getId() == $this->oneModel->getAuthor()) {
        $HTMLstr .= '<div class="fetchallOneInsideAct">
            <a href="index.php?controller=news&action=edit&id='. $this->oneModel->getId() .'">редактировать</a>
             </div>
             <div class="fetchallOneInsideAct">
            <a href="index.php?controller=news&action=delete&id='.$this->oneModel->getId().'">удалить</a>
                </div>';
    }
}

$HTMLstr .= '</div>
    <div class="fetchallOne" id="frame">
    <div class="head">
    Тэги:
    </div>';
if(!empty($this->allTags)) {
    foreach($this->allTags as $oneTag) {
        $HTMLstr .= '<div class="fetchallOneInsideTitle">
            <a href="index.php?controller=news&action=byTag&id='. $oneTag->getId() .'">'. $oneTag->getText() .'</a>
                </div>';
    }
} else {
    $HTMLstr .= '<div class="fetchallOneInsideTitle">
        К этой новости пока не добавлено ни одного тэга
        </div>';
}
$HTMLstr .= '</div>';

$HTMLstr .= '<div class="fetchallOne" id="frame">
    <div class="head">
    Комметарии:
    </div>';
if (!empty ($this->allComments)) {
    foreach($this->allComments as $oneComment) {
        $HTMLstr .= '<div class="fetchallOne" id="comment">
            <div class="fetchallOneInsideAvatar">
            <a href="?controller=user&id='. $oneComment->getAuthor() .'">
            <img height="100%" src="stuff/images/saved/'. model_ConfigMapper::findAvatar2($oneComment->getAuthor()) .'.jpg">
                </a>
                </div>
                <div class="findOneInsideLeft">
                <div class="fetchallOneInsideTitle">
                 Добавил:
                 </div>
                 <div class="fetchallOneInsideTitle">
                 <a href="?controller=user&id='. $oneComment->getAuthor() .'">'
                . model_ConfigMapper::findAuthor($oneComment->getAuthor()) .'
                 </a>
                 </div>
                 <div class="fetchallOneInsideTitle">
                 '. $oneComment->getDate().'
                     </div>
                     </div>
                     <div class="fetchallOneInsideTitle">
                    '. $oneComment->getText() .'
                       </div>';

        if (!empty($user)) {
            if ( 'admin' == $user->getRole() || $user->getId() == $oneComment->getAuthor()) {
                $HTMLstr .= '<div class="fetchallOneInsideAct">
                    <a href="index.php?controller=news&action=delComment&id='. $oneComment->getId() .'">удалить</a>
                        </div>';
            }
        }
        $HTMLstr .= '</div>';
    }
} else {
    $HTMLstr .= '<div class="fetchallOneInsideTitle">
        К этой новости пока никто не оставил ни одного комментария
        </div>';
}


if (null != $user->getId()) {
    include 'view/news/comment.phtml';
}

$HTMLstr .= '</div>
    <div class="space">
    <div>
    <div class="fetchallOneInsideAct">
    <a href="index.php">Ко всем новостям</a>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>';